package top.lshaci.learning.alibaba.cloud.seata.account.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.lshaci.learning.alibaba.cloud.seata.account.entity.Account;
import top.lshaci.learning.alibaba.cloud.seata.account.mapper.AccountMapper;
import top.lshaci.learning.alibaba.cloud.seata.account.service.AccountService;

/**
 * AccountServiceImpl
 *
 * @author lshaci
 * @since 1.0.0
 */
@Service
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements AccountService {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void debit(String userId, int money) {
        if (money == 600) {
            int i = 1 / 0;
        }
        baseMapper.debit(userId, money);
    }
}
